home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / hobby / ast44src.zip / ASTROLOG.H < prev    next >
C/C++ Source or Header  |  1995-02-11  |  43KB  |  1,203 lines

  1. /*
  2. ** Astrolog (Version 4.40) File: astrolog.h
  3. **
  4. ** IMPORTANT NOTICE: The graphics database and chart display routines
  5. ** used in this program are Copyright (C) 1991-1995 by Walter D. Pullen
  6. ** (astara@u.washington.edu). Permission is granted to freely use and
  7. ** distribute these routines provided one doesn't sell, restrict, or
  8. ** profit from them in any way. Modification is allowed provided these
  9. ** notices remain with any altered or edited versions of the program.
  10. **
  11. ** The main planetary calculation routines used in this program have
  12. ** been Copyrighted and the core of this program is basically a
  13. ** conversion to C of the routines created by James Neely as listed in
  14. ** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  15. ** available from Matrix Software. The copyright gives us permission to
  16. ** use the routines for personal use but not to sell them or profit from
  17. ** them in any way.
  18. **
  19. ** The PostScript code within the core graphics routines are programmed
  20. ** and Copyright (C) 1992-1993 by Brian D. Willoughby
  21. ** (brianw@sounds.wa.com). Conditions are identical to those above.
  22. **
  23. ** The extended accurate ephemeris databases and formulas are from the
  24. ** calculation routines in the program "Placalc" and are programmed and
  25. ** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
  26. ** (alois@azur.ch). The use of that source code is subject to
  27. ** regulations made by Astrodienst Zurich, and the code is not in the
  28. ** public domain. This copyright notice must not be changed or removed
  29. ** by any user of this program.
  30. **
  31. ** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
  32. ** X Window graphics initially programmed 10/23-29/1991.
  33. ** PostScript graphics initially programmed 11/29-30/1992.
  34. ** Last code change made 1/29/1995.
  35. */
  36.  
  37. /*
  38. ** TO COMPILE: For most systems, especially Unix, DOS, and Macs, the only
  39. ** changes that should need to be made to the code are to edit or comment the
  40. ** #define's below to equal the particulars of your own system and locale:
  41. ** 
  42. ** SYSTEM SECTION: These settings describe platform and hardware specifics.
  43. ** They are all required to be set properly or the program likely won't
  44. ** compile or run. Some of these are technically optional and can be
  45. ** commented out even if your system would normally support them, e.g.
  46. ** the X11 graphics can be disabled even if you are running X windows.
  47. */
  48.  
  49. #define PC /* Comment out this #define if you have a Unix, Mac, or some */
  50.            /* other system that isn't a generic PC running DOS.        */
  51.  
  52. /*#define MAC /* Comment out this #define if you're not compiling for a Mac. */
  53.  
  54. /*#define X11 /* Comment out this #define if you don't have X windows, or */
  55.             /* else have them and don't wish to compile in X graphics.  */
  56.  
  57. #define MSG /* Comment out this #define if you don't have access to the     */
  58.             /* Microsoft C PC graphics library as in graph.h, or you do and */
  59.             /* have a PC and just don't wish to compile these graphics in.  */
  60.  
  61. /*#define BGI /* Comment out this #define if you don't have access to the  */
  62.             /* Borland C BGI graphics library for PC's in graphics.h, or */
  63.             /* you do and just don't wish to compile such graphics in.   */
  64.  
  65. #define MOUSE /* Comment out this #define if you don't have a mouse, or */
  66.               /* don't wish to compile in mouse tracking features. This */
  67.               /* is only an option if X11, MSG, or BGI above are set.   */
  68.  
  69. #define TIME /* Comment out this #define if your compiler can't take the  */
  70.              /* calls to the 'time' or 'localtime' functions as in time.h */
  71.  
  72. #define SWITCHES /* Comment out this #define if your system can not handle */
  73.                  /* parameters on the command line (such as Mac's).        */
  74.  
  75. #define ENVIRON /* Comment out this #define if your system doesn't have  */
  76.                 /* environment variables or can't compile calls to them. */
  77.  
  78. /*#define ATOF /* Comment out this #define if you have a system in which  */
  79.              /* 'atof' and related functions aren't defined in stdio.h, */
  80.              /* such as most PC's, Linux, VMS compilers, and NeXT's.    */
  81.  
  82. #define PROTO /* Comment out this #define if you have an older compiler   */
  83.               /* which doesn't allow full Ansi function prototypes. This  */
  84.               /* is for programmers only and has no effect on executable. */
  85.  
  86. /*
  87. ** FEATURES SECTION: These settings describe features that are always
  88. ** available to be compiled into the program no matter what platform or
  89. ** hardware is available. Their settings are always optional.
  90. */
  91.  
  92. #define GRAPH /* Comment out this #define if you don't want any graphics   */
  93.               /* in the program. This switch allows at least generation of */
  94.               /* bitmap files and must be set if any of the more advanced  */
  95.               /* graphics feature additions are also compiled in.          */
  96.  
  97. #define PLACALC /* Comment out this #define if you don't want the more */
  98.                 /* accurate calculation features and formulas to be    */
  99.                 /* compiled into the program (as accessed with -b).    */
  100.  
  101. #define PS /* Comment out this #define if you don't want the ability to */
  102.            /* generate charts in the PostScript graphics format.        */
  103.  
  104. #define META /* Comment out this #define if you don't want the ability to  */
  105.              /* generate charts in the MS Windows metafile picture format. */
  106.  
  107. #define INTERPRET /* Comment out this #define if you don't want the ability */
  108.                   /* to display interpretations of the various chart types. */
  109.  
  110. #define ARABIC /* Comment out this #define if you don't want any chart     */
  111.                /* lists that include Arabic parts included in the program. */
  112.  
  113. #define CONSTEL /* Comment out this #define if you don't want any of the */
  114.                 /* astronomical constellation charts in the program.     */
  115.  
  116. #define BIORHYTHM /* Comment out this #define if you don't want the    */
  117.                   /* non-astrological biorhythm charts in the program. */
  118.  
  119. /*
  120. ** DATA CONFIGURATION SECTION: These settings describe particulars of
  121. ** your own location and where the program looks for certain info. It is
  122. ** recommended that these values be changed appropriately, although the
  123. ** program will still run if they are left alone.
  124. */
  125.  
  126. #ifndef PC
  127. #define DEFAULT_DIR "~/astrolog"
  128. #else
  129. #define DEFAULT_DIR "C:\\ASTROLOG"
  130. #endif
  131.   /* Change this string to directory path program should look in for the  */
  132.   /* astrolog.dat default file, if one is not in the current directory or */
  133.   /* in the dirs indicated by environment variables. For PC systems, use  */
  134.   /* two backslashes instead of one forward one to divide subdirectories. */
  135.  
  136. #define CHART_DIR DEFAULT_DIR
  137.   /* This string is the directory the program looks in for chart info    */
  138.   /* files (-i switch) if not in the current directory. This is normally */
  139.   /* the default dir above but may be changed to be somewhere else.      */
  140.  
  141. #define EPHE_DIR DEFAULT_DIR
  142.   /* This string is the directory the program looks in for the ephemeris */
  143.   /* files as accessed with the -b switch. This is normally the default  */
  144.   /* dir above but may be changed to be somewhere else.                  */
  145.  
  146. #define DEFAULT_LONG 122.20 /* Change these values to the longitude west    */
  147. #define DEFAULT_LAT   47.36 /* and latitude north of your current location. */
  148.                             /* Use negative values for east/southern areas. */
  149.  
  150. #define DEFAULT_ZONE 8.00 /* Change this number to the time zone of your */
  151.                           /* current location in hours before (west of)  */
  152.                           /* GMT. Use negative values for eastern zones. */
  153.  
  154. /*
  155. ** OPTIONAL CONFIGURATION SECTION: Although not necessary, one may like
  156. ** to change some of the values below: These constants affect some of
  157. ** the default parameters and other such things.
  158. */
  159.  
  160. #define DEFAULT_SYSTEM 0 /* Normally, Placidus houses are used (unless the */
  161.                          /* user specifies otherwise). If you want a       */
  162.                          /* different default system, change this number   */
  163.                          /* to a value from 0..9 (values same as in -c).   */
  164.  
  165. #define DEFAULT_ASPECTS 5 /* Default number of aspects to use in charts. */
  166.  
  167. #define DIVISIONS 12 /* Greater numbers means more accuracy but slower  */
  168.                      /* calculation, of exact aspect and transit times. */
  169.  
  170. #define DEFAULT_INFOFILE "astrolog.dat"
  171.   /* Name of file to look in for default program parameters (which will */
  172.   /* override the compile time values here, if the file exists).        */
  173.  
  174. #define ENVIRONALL "ASTROLOG"
  175. #define ENVIRONVER "ASTR"
  176.   /* Name of environment variables to look in for chart, ephemeris, and  */
  177.   /* default files. The second name is a version specific variable which */
  178.   /* gets the current version appended to it before it is accessed.      */
  179.  
  180. #define WHEELCOLS 15   /* Affects width of each house in wheel display.    */
  181. #define WHEELROWS 11   /* Max no. of objects that can be in a wheel house. */
  182. #define SCREENWIDTH 80 /* Number of columns to print interpretations in.   */
  183. #define MONTHSPACE 3   /* Number of spaces between each calendar column.   */
  184. #define MAXINDAY 150   /* Max number of aspects or transits displayable.   */
  185. #define MAXCROSS 750   /* Max number of latitude crossings displayable.    */
  186. #define CREDITWIDTH 74 /* Number of text columns in the -Hc credit screen. */
  187. #define MAXSWITCHES 32 /* Max number of switch parameters per input line.  */
  188. #define PSGUTTER 9     /* Points of white space on PostScript page edge.   */
  189.  
  190.  
  191. #ifdef GRAPH           /* For graphics, this char affects how bitmaps are */
  192. #ifndef PC             /* written. 'N' is written like with the 'bitmap'  */
  193. #define BITMAPMODE 'C' /* program, 'C' is compacted somewhat (files have  */
  194. #else                  /* less spaces), and 'V' is compacted even more.   */
  195. #define BITMAPMODE 'B' /* 'A' means write as rectangular Ascii text file. */
  196. #endif                 /* 'B' means write as Windows bitmap (.bmp) file.  */
  197.  
  198. #ifdef MSG
  199. #define DEFHIRESMODE _MAXRESMODE /* 'High-resolution' PC graphics mode. */
  200. #define DEFLORESMODE _ERESCOLOR  /* 'Flicker-free' PC graphics mode.    */
  201. #endif
  202. #ifdef BGI
  203. #define DEFHIRESMODE 0 /* Zero or less means a 'hi-res' mode of driver. */
  204. #define DEFLORESMODE 1 /* One or more means a 'lo-res' mode of driver.  */
  205. #endif
  206. #endif /* GRAPH */
  207.  
  208. /*#define TRUENODE /* Comment out this #define if you'd prefer the 'Node'    */
  209.                  /* object to refer to the Mean North Node of the Moon by  */
  210.                  /* default as opposed to the True North Node of the Moon. */
  211.  
  212. /*
  213. ** By the time you reach here and the above values are customized as
  214. ** desired, Astrolog is ready to be compiled! Be sure to similarly
  215. ** change the values in the astrolog.dat file, which will override any
  216. ** corresponding compile time values here. Don't change any of the
  217. ** values in the section below unless you know what you're doing.
  218. */
  219.  
  220. #ifdef GRAPH
  221. #define BITMAPX  2730   /* Maximum window size allowed */
  222. #define BITMAPY  2730
  223. #define BITMAPX1 180    /* Minimum window size allowed */
  224. #define BITMAPY1 180
  225. #define DEFAULTX 480    /* Default window size */
  226. #define DEFAULTY 480
  227. #define SIDESIZE 160    /* Size of wheel chart information sidebar.    */
  228. #define MAXMETA 200000L /* Max bytes allowed in a metafile.            */
  229. #define METAMUL   12    /* Metafile coordinate to chart pixel ratio.   */
  230. #define PSMUL     11    /* PostScript coordinate to chart pixel ratio. */
  231. #define CELLSIZE  14    /* Size for each cell in the aspect grid.      */
  232. #define BIODAYS   14    /* Days to include in graphic biorhythms.      */
  233. #define DEGINC     2    /* Number of degrees per segment for circles.  */
  234. #define DEFORB   7.0    /* Min distance glyphs can be from each other  */
  235. #endif /* GRAPH */
  236.  
  237. #define chH    (char)(us.fAnsi ? 196 : '-')  /* Ansi and Ascii characters  */
  238. #define chV    (char)(us.fAnsi ? 179 : '|')  /* used to print text charts. */
  239. #define chC    (char)(us.fAnsi ? 197 : '|')
  240. #define chNW   (char)(us.fAnsi ? 218 : '+')
  241. #define chNE   (char)(us.fAnsi ? 191 : '+')
  242. #define chSW   (char)(us.fAnsi ? 192 : '+')
  243. #define chSE   (char)(us.fAnsi ? 217 : '+')
  244. #define chJN   (char)(us.fAnsi ? 193 : '-')
  245. #define chJS   (char)(us.fAnsi ? 194 : '-')
  246. #define chJW   (char)(us.fAnsi ? 180 : '|')
  247. #define chJE   (char)(us.fAnsi ? 195 : '|')
  248. #define chDeg0 (char)(us.fAnsi ? 248 : ' ')
  249. #define chDeg1 (char)(us.fAnsi ? 248 : ':')
  250.  
  251.  
  252. /*
  253. ** One shouldn't ever need to change anything below this line to compile.
  254. */
  255.  
  256. #define ASTROLOG
  257. #define MATRIX
  258. #include <stdio.h>
  259. #ifndef ATOF
  260. #include <stdlib.h>
  261. #endif
  262. #include <math.h>
  263. #ifdef PC
  264. #include <malloc.h>
  265. #endif
  266. #ifdef TIME
  267. #include <time.h>
  268. #endif
  269.  
  270. #ifdef X11
  271. #define ISG
  272. #include <X11/Xlib.h>
  273. #include <X11/Xutil.h>
  274. #endif
  275. #ifdef MSG
  276. #define ISG
  277. #define PCG
  278. #include <graph.h>
  279. #include <conio.h>
  280. #endif
  281. #ifdef BGI
  282. #define ISG
  283. #define PCG
  284. #include <graphics.h>
  285. #include <conio.h>
  286. #endif
  287.  
  288. #ifdef PS
  289. #define STROKE
  290. #endif
  291. #ifdef META
  292. #define STROKE
  293. #endif
  294. #ifdef MOUSE
  295. #ifdef PC
  296. #include <dos.h>
  297. #endif
  298. #endif /* MOUSE */
  299.  
  300.  
  301. /*
  302. ** Make sure only legal combinations of the graphics options are active.
  303. */
  304.  
  305. #ifdef MAC
  306. #ifdef ISG
  307. "If 'MAC' is defined 'X11', 'MSG', or 'BGI' must not be as well"
  308. #endif
  309. #ifdef SWITCHES
  310. "If 'MAC' is defined 'SWITCHES' must not be as well"
  311. #endif
  312. #ifdef ENVIRON
  313. "If 'MAC' is defined 'ENVIRON' must not be as well"
  314. #endif
  315. #endif /* MAC */
  316.  
  317. #ifdef X11
  318. #ifndef GRAPH
  319. "If 'X11' is defined 'GRAPH' must be too"
  320. #endif
  321. #ifdef MSG
  322. "If 'X11' is defined 'MSG' must not be as well"
  323. #endif
  324. #ifdef PC
  325. "If 'X11' is defined 'PC' must not be as well"
  326. #endif
  327. #endif /* X11 */
  328.  
  329. #ifdef MSG
  330. #ifndef GRAPH
  331. "If 'MSG' is defined 'GRAPH' must be too"
  332. #endif
  333. #ifdef X11
  334. "If 'MSG' is defined 'X11' must not be as well"
  335. #endif
  336. #ifdef BGI
  337. "If 'MSG' is defined 'BGI' must not be as well"
  338. #endif
  339. #ifndef PC
  340. "If 'MSG' is defined 'PC' must be too"
  341. #endif
  342. #endif /* MSG */
  343.  
  344. #ifdef BGI
  345. #ifndef GRAPH
  346. "If 'BGI' is defined 'GRAPH' must be too"
  347. #endif
  348. #ifdef X11
  349. "If 'BGI' is defined 'X11' must not be as well"
  350. #endif
  351. #ifdef MSG
  352. "If 'BGI' is defined 'MSG' must not be as well"
  353. #endif
  354. #ifndef PC
  355. "If 'BGI' is defined 'PC' must be too"
  356. #endif
  357. #endif /* BGI */
  358.  
  359. #ifdef MOUSE
  360. #ifdef GRAPH
  361. #ifndef ISG
  362. "If 'MOUSE' is defined 'X11', 'MSG', or 'BGI' must be too"
  363. #endif
  364. #endif /* GRAPH */
  365. #endif /* MOUSE */
  366.  
  367. #ifdef PS
  368. #ifndef GRAPH
  369. "If 'PS' is defined 'GRAPH' must be too"
  370. #endif
  371. #endif /* PS */
  372.  
  373. #ifdef META
  374. #ifndef GRAPH
  375. "If 'META' is defined 'GRAPH' must be too"
  376. #endif
  377. #endif /* META */
  378.  
  379.  
  380. /*
  381. ******************************************************************************
  382. ** Program Constants.
  383. ******************************************************************************
  384. */
  385.  
  386. #ifndef FALSE
  387. #define FALSE 0
  388. #endif
  389. #ifndef TRUE
  390. #define TRUE  1
  391. #endif
  392. #define fFalse FALSE
  393. #define fTrue  TRUE
  394.  
  395. #define szAppNameCore "Astrolog"
  396. #define szVersionCore "4.40"
  397. #define szDateCore    "February 1995"
  398. #define szAddressCore "astara@u.washington.edu"
  399. #define szNowCore     "now"
  400. #define szTtyCore     "tty"
  401. #define szSetCore     "set"
  402. #define szNulCore     "nul"
  403.  
  404. #define cchSzDef   80
  405. #define cchSzMax   255
  406. #define nDegMax    360
  407. #define nDegHalf   180
  408. #define yeaJ2G     1582
  409. #define monJ2G     mOct
  410. #define dayJ2G1    4
  411. #define dayJ2G2    15
  412.  
  413. #define rPi        3.14159265358979323846
  414. #define rPi2       (rPi*2.0)
  415. #define rPiHalf    (rPi/2.0)
  416. #define rDegMax    360.0
  417. #define rDegHalf   180.0
  418. #define rDegQuad   90.0
  419. #define rDegRad    (rDegHalf/rPi)
  420. #define rEpoch2000 (-24.736467)
  421. #define rAxis      23.44578889
  422. #define rSmall     (1.7453E-09)
  423. #define rLarge     10000.0
  424. #define rRound     0.5
  425.  
  426. #define chNull     '\0'
  427. #define chEscape   '\33'
  428. #define chBell     '\7'
  429. #define chReturn   '\r'
  430. #define chTab      '\t'
  431. #define chDelete   '\b'
  432. #define chBreak    '\3'
  433. #define chRet      'R'
  434.  
  435. /* Array index limits */
  436.  
  437. #define cSign      12
  438. #define cObj       87
  439. #define cObjInt    uranHi
  440. #define objMax     (cObj+1)
  441. #define cAspect    18
  442. #define cAspectInt 11
  443. #define cSystem    13
  444. #define cCnstl     88
  445. #define cZone      69
  446. #define cPart      177
  447. #define xFont      6
  448. #define yFont      10
  449. #define xFontT     (xFont*gi.nScaleT)
  450. #define yFontT     (yFont*gi.nScaleT)
  451. #define xSideT     (SIDESIZE*gi.nScaleT)
  452.  
  453. /* Object array index values */
  454.  
  455. #define cPlanet oVes
  456. #define cThing  oLil
  457. #define oMain   10
  458. #define oCore   20
  459. #define cUran   8
  460. #define cStar   47
  461. #define cuspLo  21
  462. #define cuspHi  32
  463. #define uranLo  33
  464. #define uranHi  40
  465. #define oNorm   uranHi
  466. #define starLo  41
  467. #define starHi  cObj
  468.  
  469. /* Other specific index values */
  470.  
  471. #define mJan 1
  472. #define mFeb 2
  473. #define mMar 3
  474. #define mApr 4
  475. #define mMay 5
  476. #define mJun 6
  477. #define mJul 7
  478. #define mAug 8
  479. #define mSep 9
  480. #define mOct 10
  481. #define mNov 11
  482. #define mDec 12
  483.  
  484. #define eFir 0
  485. #define eEar 1
  486. #define eAir 2
  487. #define eWat 3
  488.  
  489. #define sAri 1
  490. #define sTau 2
  491. #define sGem 3
  492. #define sCan 4
  493. #define sLeo 5
  494. #define sVir 6
  495. #define sLib 7
  496. #define sSco 8
  497. #define sSag 9
  498. #define sCap 10
  499. #define sAqu 11
  500. #define sPis 12
  501.  
  502. #define oEar 0
  503. #define oSun 1
  504. #define oMoo 2
  505. #define oMer 3
  506. #define oVen 4
  507. #define oMar 5
  508. #define oJup 6
  509. #define oSat 7
  510. #define oUra 8
  511. #define oNep 9
  512. #define oPlu 10
  513. #define oChi 11
  514. #define oVes 15
  515. #define oNod 16
  516. #define oLil 17
  517. #define oSou 17
  518. #define oFor 18
  519. #define oVtx 19
  520. #define oEP  20
  521. #define oAsc 21
  522. #define oNad 24
  523. #define oDes 27
  524. #define oMC  30
  525.  
  526. #define aDir -2
  527. #define aSig -1
  528. #define aCon 1
  529. #define aOpp 2
  530. #define aSqu 3
  531. #define aTri 4
  532. #define aSex 5
  533. #define aInc 6
  534. #define aSSx 7
  535. #define aSSq 8
  536. #define aSes 9
  537. #define aQui 10
  538. #define aBQn 11
  539.  
  540. #define brPhy 23.0
  541. #define brEmo 28.0
  542. #define brInt 33.0
  543.  
  544. /* Relationship chart modes */
  545.  
  546. #define rcSynastry   1
  547. #define rcComposite  2
  548. #define rcMidpoint   3
  549. #define rcDifference 4
  550. #define rcBiorhythm  5
  551. #define rcDual      -1
  552. #define rcTransit   -2
  553. #define rcProgress  -3
  554.  
  555. /* Aspect configurations */
  556.  
  557. #define acS  1
  558. #define acGT 2
  559. #define acTS 3
  560. #define acY  4
  561. #define acGC 5
  562. #define acC  6
  563.  
  564. /* Graphics chart modes */
  565.  
  566. #define gWheel      1
  567. #define gHouse      2
  568. #define gGrid       3
  569. #define gHorizon    4
  570. #define gOrbit      5
  571. #define gAstroGraph 6
  572. #define gEphemeris  7
  573. #define gWorldMap   8
  574. #define gGlobe      9
  575. #define gPolar     10
  576. #define gBiorhythm 11
  577. #define gCalendar  12
  578. #define gDisposit  13
  579.  
  580. /* Colors */
  581.  
  582. #define kReverse -2
  583. #define kDefault -1
  584. #define kBlack   0
  585. #define kMaroon  1
  586. #define kDkGreen 2
  587. #define kOrange  3
  588. #define kDkBlue  4
  589. #define kPurple  5
  590. #define kDkCyan  6
  591. #define kLtGray  7
  592. #define kDkGray  8
  593. #define kRed     9
  594. #define kGreen   10
  595. #define kYellow  11
  596. #define kBlue    12
  597. #define kMagenta 13
  598. #define kCyan    14
  599. #define kWhite   15
  600. #define kNull    16
  601.  
  602. /* Other enumerations */
  603.  
  604. #define apFor 0
  605. #define apSpi 1
  606.  
  607. #define dtCent   0x0
  608. #define dtLeft   0x1
  609. #define dtBottom 0x2
  610. #define dtErase  0x4
  611. #define dtScale  0x8
  612. #define dtTop    0x10
  613.  
  614. #define pmMon     1
  615. #define pmDay     2
  616. #define pmYea     3
  617. #define pmTim     4
  618. #define pmDst     5
  619. #define pmZon     6
  620. #define pmLon     7
  621. #define pmLat     8
  622. #define pmObject  9
  623. #define pmAspect 10
  624. #define pmSystem 11
  625. #define pmSign   12
  626. #define pmColor  13
  627.  
  628. #define mfLeft   0x01
  629. #define mfRight  0x02
  630. #define mfMiddle 0x04
  631.  
  632. /* Termination codes */
  633.  
  634. #define tcError -1
  635. #define tcOK    0
  636. #define tcFatal 1
  637. #define tcForce 2
  638.  
  639. #ifndef _ZRES256COLOR
  640. #define _ZRES256COLOR 263
  641. #endif
  642.  
  643.  
  644. /*
  645. ******************************************************************************
  646. ** Macro Functions.
  647. ******************************************************************************
  648. */
  649.  
  650. #define BLo(w) ((byte)(w))
  651. #define BHi(w) ((byte)((word)(w) >> 8 & 0xFF))
  652. #define WLo(l) ((word)(dword)(l))
  653. #define WHi(l) ((word)((dword)(l) >> 16 & 0xFFFF))
  654. #define WFromBB(bLo, bHi) ((word)BLo(bLo) | (word)((byte)(bHi)) << 8)
  655. #define LFromWW(wLo, wHi) ((dword)WLo(wLo) | (dword)((word)(wHi)) << 16)
  656. #define LFromBB(b1, b2, b3, b4) LFromWW(WFromBB(b1, b2), WFromBB(b3, b4))
  657. #define RGB(bR, bG, bB) \
  658.   ((dword)((byte)(bR) | (word)(bG)<<8 | (dword)(byte)(bB)<<16))
  659. #define RGBR(l) BLo(l)
  660. #define RGBG(l) BHi(l)
  661. #define RGBB(l) ((byte)((dword)(l) >> 16 & 0xFF))
  662. #define ChHex(n) (char)((n) < 10 ? '0' + (n) : 'a' + (n) - 10)
  663. #define VgaFromEga(x) NMultDiv((x), 480, 350)
  664. #define VgaFromCga(x) NMultDiv((x), 480, 200)
  665.  
  666. #define Max(v1, v2) ((v1) > (v2) ? (v1) : (v2))
  667. #define Min(v1, v2) ((v1) < (v2) ? (v1) : (v2))
  668. #define NSgn(n) ((n) < 0 ? -1 : (n) > 0 ? 1 : 0)
  669. #define RSgn2(r) ((r) < 0.0 ? -1.0 : 1.0)
  670. #define FBetween(v, v1, v2) ((v) >= (v1) && (v) <= (v2))
  671. #define RFract(r) ((r) - RFloor(r))
  672. #define ChCap(ch) ((ch) >= 'a' && (ch) <= 'z' ? (ch) - 'a' + 'A' : (ch))
  673. #define ChUncap(ch) (FCapCh(ch) ? (ch) - 'A' + 'a' : (ch))
  674. #define FCapCh(ch) ((ch) >= 'A' && (ch) <= 'Z')
  675. #define FNumCh(ch) ((ch) >= '0' && (ch) <= '9')
  676. #define NMultDiv(n1, n2, n3) ((int)((long)(n1) * (n2) / (n3)))
  677. #define Ratio(v1, v2, v3) ((v1) + ((v2) - (v1)) * (v3))
  678. #define ZFromS(s) ((real)(((s)-1)*30))
  679. #define SFromZ(r) (((int)(r))/30+1)
  680. #define RFromD(r) ((r)/rDegRad)
  681. #define DFromR(r) ((r)*rDegRad)
  682. #define RAbs(r) fabs(r)
  683. #define RFloor(r) floor(r)
  684. #define NFloor(r) ((int)RFloor(r))
  685. #define RSqr(r) sqrt(r)
  686. #define RSin(r) sin(r)
  687. #define RCos(r) cos(r)
  688. #define RTan(r) tan(r)
  689. #define RAtn(r) atan(r)
  690. #define RAsin(r) asin(r)
  691. #define RAcos(r) acos(r)
  692. #define RSinD(r) RSin(RFromD(r))
  693. #define RCosD(r) RCos(RFromD(r))
  694. #define NSinD(nR, nD) ((int)((real)(nR)*RSinD((real)nD)))
  695. #define NCosD(nR, nD) ((int)((real)(nR)*RCosD((real)nD)))
  696.  
  697. #define FItem(obj)    FBetween(obj, 1, cObj)
  698. #define FNorm(obj)    FBetween(obj, 1, oNorm)
  699. #define FCusp(obj)    FBetween(obj, cuspLo, cuspHi)
  700. #define FAngle(obj)   (FCusp(obj) && (obj)%3 == 0)
  701. #define FMinor(obj)   (FCusp(obj) && (obj)%3 != 0)
  702. #define FUranian(obj) FBetween(obj, uranLo, uranHi)
  703. #define FStar(obj)    FBetween(obj, starLo, starHi)
  704. #define FObject(obj)  ((obj) <= oVes || (obj) >= uranLo)
  705. #define FThing(obj)   ((obj) <= cThing || (obj) >= uranLo)
  706. #define FHelio(obj)   (FNorm(obj) && FObject(obj) && (obj) != oMoo)
  707. #define FAspect(asp)  FBetween(asp, 1, us.nAsp)
  708. #define DayInYearHi(yea) (365-28+DayInMonth(2, yea))
  709. #define FChSwitch(ch) \
  710.   ((ch) == '-' || (ch) == '/' || (ch) == '_' || (ch) == '=' || (ch) == ':')
  711.  
  712. #define FValidMon(mon) FBetween(mon, 1, 12)
  713. #define FValidDay(day, mon, yea) ((day) >= 1 && (day) <= DayInMonth(mon, yea))
  714. #define FValidYea(yea) FBetween(yea, -20000, 20000)
  715. #define FValidTim(tim) ((tim) > -2.0 && (tim) < 24.0)
  716. #define FValidDst(dst) FValidZon(dst)
  717. #define FValidZon(zon) FBetween(zon, -24.0, 24.0)
  718. #define FValidLon(lon) FBetween(lon, -rDegHalf, rDegHalf)
  719. #define FValidLat(lat) FBetween(lat, -rDegQuad, rDegQuad)
  720. #define FValidAspect(asp) FBetween(asp, 0, cAspect)
  721. #define FValidSystem(n) FBetween(n, 0, cSystem)
  722. #define FValidDivision(n) FBetween(n, 1, 2880)
  723. #define FValidHarmonic(n) FBetween(n, 1, 30000)
  724. #define FValidWheel(n) FBetween(n, 1, WHEELROWS)
  725. #define FValidPart(n) FBetween(n, 1, cPart)
  726. #define FValidScreen(n) FBetween(n, 20, 200)
  727. #define FValidMacro(n) FBetween(n, 1, 48)
  728. #define FValidTextrows(n) ((n) == 25 || (n) == 43 || (n) == 50)
  729. #define FValidGlyphs(n) FBetween(n, 0, 2223)
  730. #define FValidGrid(n) FBetween(n, 1, cObj)
  731. #define FValidScale(n) (FBetween(n, 100, 400) && (n)%100 == 0)
  732. #define FValidGraphx(x) (FBetween(x, BITMAPX1, BITMAPX) || (x) == 0)
  733. #define FValidGraphy(y) (FBetween(y, BITMAPY1, BITMAPY) || (y) == 0)
  734. #define FValidRotation(n) FBetween(n, 0, nDegMax-1)
  735. #define FValidTilt(n) FBetween(n, -rDegQuad, rDegQuad)
  736. #define FValidBmpmode(ch) \
  737.   ((ch) == 'N' || (ch) == 'C' || (ch) == 'V' || (ch) == 'A' || (ch) == 'B')
  738.  
  739. #define chSig3(A) szSignName[A][0], szSignName[A][1], szSignName[A][2]
  740. #define chObj3(A) szObjName[A][0], szObjName[A][1], szObjName[A][2]
  741. #define chMon3(A) szMonth[A][0], szMonth[A][1], szMonth[A][2]
  742. #define chDay3(A) szDay[A][0], szDay[A][1], szDay[A][2]
  743. #define kSignA(s) kElemA[(s)-1 & 3]
  744. #define kSignB(s) kElemB[(s)-1 & 3]
  745. #define kModeA(m) kElemA[m <= 1 ? m : eWat]
  746. #define fSouthNode (!us.fPlacalc)
  747.  
  748. #define loop for (;;)
  749. #define not(V) V = !(V)
  750. #define neg(V) V = -(V)
  751. #define PrintL() PrintCh('\n')
  752. #define PrintL2() PrintSz("\n\n")
  753. #define SwapN(n1, n2) (n1)^=(n2)^=(n1)^=(n2)
  754. #define SwitchF(f) f = (((f | fOr) & !fAnd) ^ fNot)
  755. #define SwitchF2(f) f = ((f | (fOr || fNot)) & !fAnd)
  756. #define SetCI(ci, M, D, Y, T, S, Z, O, A) \
  757.   ci.mon = M; ci.day = D; ci.yea = Y; \
  758.   ci.tim = T; ci.dst = S; ci.zon = Z; ci.lon = O; ci.lat = A
  759.  
  760. #ifndef PC
  761. #define chDirSep '/'
  762. #define chSwitch '-'
  763. #define CONST
  764. #define NEAR
  765. #define FAR
  766. #define HFAR
  767. #define AllocateNear(p, cb) (p) = (void *)malloc(cb)
  768. #define AllocateFar(p, cb)  AllocateNear(p, cb)
  769. #define AllocateHuge(p, cb) AllocateFar(p, cb)
  770. #define DeallocateNear(p) free(p)
  771. #define DeallocateFar(p)  DeallocateNear(p)
  772. #define DeallocateHuge(p) DeallocateFar(p)
  773. #ifndef MAC
  774. #define ldTime 2440588L
  775. #else
  776. #define ldTime 2416481L
  777. #endif
  778. #define ARR
  779. #else /* PC */
  780. #define chDirSep '\\'
  781. #define chSwitch '/'
  782. #define CONST const
  783. #define NEAR near
  784. #define FAR far
  785. #define HFAR huge
  786. #define AllocateNear(p, cb) (p) = malloc(cb)
  787. #define AllocateFar(p, cb)  (p) = _fmalloc(cb)
  788. #define AllocateHuge(p, cb) (p) = halloc(cb, sizeof(byte))
  789. #define DeallocateNear(p) free(p)
  790. #define DeallocateFar(p)  _ffree(p)
  791. #define DeallocateHuge(p) hfree(p)
  792. #ifndef __TURBOC__
  793. #define ldTime 2415020L
  794. #define ARR
  795. #else
  796. #define ldTime 2440588L
  797. #define ARR far
  798. #endif
  799. #endif /* PC */
  800.  
  801. #ifdef GRAPH
  802. #ifdef MSG
  803. #define xPcScreen gi.cfg.numxpixels
  804. #define yPcScreen gi.cfg.numypixels
  805. #define FValidResmode(n) FBetween(n, _MAXRESMODE, _ZRES256COLOR)
  806. #define FEgaRes(res) (res == _ERESNOCOLOR || res == _ERESCOLOR)
  807. #define FCgaRes(res) (res == _HRESBW || res == _HRES16COLOR)
  808. #define PcMoveTo(x, y) _moveto(x, y)
  809. #define PcLineTo(x, y) _lineto(x, y)
  810. #define PcSetTextRows(n) _settextrows(gs.nTextRows)
  811. #endif
  812. #ifdef BGI
  813. #define xPcScreen (getmaxx()+1)
  814. #define yPcScreen (getmaxy()+1)
  815. #define FValidResmode(n) FBetween(n, -500, 500)
  816. #define FEgaRes(res) (yPcScreen == 350)
  817. #define FCgaRes(res) (yPcScreen == 200)
  818. #define PcMoveTo(x, y) moveto(x, y)
  819. #define PcLineTo(x, y) lineto(x, y)
  820. #define PcSetTextRows(n) if ((n) > 25) textmode(C4350)
  821. #endif
  822.  
  823. /* Should an object in the outer wheel be restricted? */
  824. #define FProper2(i) (!(us.nRel == rcTransit ? ignore2[i] : ignore[i]))
  825.  
  826. /* Are particular coordinates on the chart? */
  827. #define FInRect(x, y, x1, y1, x2, y2) \
  828.   ((x) >= (x1) && (x) < (x2) && (y) >= (y1) && (y) < (y2))
  829. #define FOnWin(X, Y) FInRect((X), (Y), 0, 0, gs.xWin, gs.yWin)
  830.  
  831. /* Get a coordinate based on chart radius, a fraction, and (co)sin value. */
  832. #define POINT1(U, R, S) ((int)(((U)+1.4)*(R)*(S)))
  833. #define POINT2(U, R, S) ((int)(((U)-0.3)*(R)*(S)))
  834.  
  835. /* Determine (co)sin factors based on zodiac angle and chart orientation. */
  836. #define PX(A) RCosD(A)
  837. #define PY(A) RSinD(A)
  838. #define PZ(A) Mod(rDegHalf-(A)+asc)
  839.  
  840. /* Compute Mollewide projection in pixel scale given latitude. */
  841. #define NMollewide(y) \
  842.   ((int)(RSqr((real)(180L*nScl*180L*nScl - 4L*(y)*nScl*(y)*nScl))+rRound))
  843.  
  844. /* Do settings indicate the current chart should have the info sidebar? */
  845. #define fSidebar \
  846.   ((gi.nMode == gWheel || gi.nMode == gHouse) && gs.fText && !us.fVelocity)
  847.  
  848. /* Is the current chart most properly displayed as a square graphic? */
  849. #define fSquare \
  850.   (gi.nMode == gWheel || gi.nMode == gHouse || gi.nMode == gGrid || \
  851.   (gi.nMode == gHorizon && us.fPrimeVert) || gi.nMode == gDisposit || \
  852.   gi.nMode == gOrbit || gi.nMode == gGlobe || gi.nMode == gPolar)
  853.  
  854. /* Does the current chart have to be displayed in a map rectangle? */
  855. #define fMap \
  856.   (gi.nMode == gAstroGraph || gi.nMode == gWorldMap)
  857.  
  858. /* Do settings indicate the current chart should have an outer border? */
  859. #define fDrawBorder \
  860.   ((gs.fBorder || gi.nMode == gGrid) && gi.nMode != gGlobe && \
  861.   gi.nMode != gPolar && (gi.nMode != gWorldMap || !gs.fMollewide))
  862.  
  863. /* Do settings indicate current chart should have chart info at its bottom? */
  864. #define fDrawText \
  865.   (gs.fText && gi.nMode != gCalendar && gi.nMode != gWorldMap && \
  866.   gi.nMode != gGlobe && gi.nMode != gPolar && \
  867.   ((gi.nMode != gWheel && gi.nMode != gHouse) || us.fVelocity))
  868. #endif /* GRAPH */
  869.  
  870.  
  871. /*
  872. ******************************************************************************
  873. ** Type Definitions.
  874. ******************************************************************************
  875. */
  876.  
  877. #define byte  unsigned char
  878. #define word  unsigned short
  879. #define dword unsigned long
  880. #define real  double
  881. #define _char unsigned char
  882. #define _int  unsigned int
  883. #define bool  int
  884. #define _bool char
  885. #define lpbyte byte FAR *
  886. #define hpbyte byte HFAR *
  887. #define lpreal real FAR *
  888.  
  889. typedef struct _GridInfo {
  890.   byte  n[objMax][objMax];
  891.   short v[objMax][objMax];
  892. } GridInfo;
  893.  
  894. typedef struct _CrossInfo {
  895.   real lat[MAXCROSS];
  896.   real lon[MAXCROSS];
  897.   int obj1[MAXCROSS];
  898.   int obj2[MAXCROSS];
  899. } CrossInfo;
  900.  
  901. #ifdef GRAPH
  902. #define KV unsigned long
  903. #define KI int
  904. #endif /* GRAPH */
  905.  
  906. typedef struct _UserSettings {
  907.  
  908.   /* Chart types */
  909.   _bool fListing;       /* -v */
  910.   _bool fWheel;         /* -w */
  911.   _bool fGrid;          /* -g */
  912.   _bool fAspList;       /* -a */
  913.   _bool fMidpoint;      /* -m */
  914.   _bool fHorizon;       /* -Z */
  915.   _bool fOrbit;         /* -S */
  916.   _bool fInfluence;     /* -j */
  917.   _bool fAstroGraph;    /* -L */
  918.   _bool fCalendar;      /* -K */
  919.   _bool fInDay;         /* -d */
  920.   _bool fInDayInf;      /* -D */
  921.   _bool fEphemeris;     /* -E */
  922.   _bool fTransit;       /* -t */
  923.   _bool fTransitInf;    /* -T */
  924.  
  925.   /* Chart suboptions */
  926.   _bool fVelocity;      /* -v0 */
  927.   _bool fWheelReverse;  /* -w0 */
  928.   _bool fGridConfig;    /* -g0 */
  929.   _bool fAppSep;        /* -ga */
  930.   _bool fParallel;      /* -gp */
  931.   _bool fAspSummary;    /* -a0 */
  932.   _bool fMidSummary;    /* -m0 */
  933.   _bool fPrimeVert;     /* -Z0 */
  934.   _bool fHorizonSearch; /* -Zd */
  935.   _bool fInfluenceSign; /* -j0 */
  936.   _bool fLatitudeCross; /* -L0 */
  937.   _bool fCalendarYear;  /* -Ky */
  938.   _bool fInDayMonth;    /* -dm */
  939.   _bool fArabicFlip;    /* -P0 */
  940.  
  941.   /* Table chart types */
  942.   _bool fCredit;        /* -Hc */
  943.   _bool fSwitch;        /* -H  */
  944.   _bool fSwitchRare;    /* -Y  */
  945.   _bool fKeyGraph;      /* -HX */
  946.   _bool fSign;          /* -HC */
  947.   _bool fObject;        /* -HO */
  948.   _bool fAspect;        /* -HA */
  949.   _bool fConstel;       /* -HF */
  950.   _bool fOrbitData;     /* -HS */
  951.   _bool fMeaning;       /* -HI */
  952.  
  953.   /* Main flags */
  954.   _bool fLoop;        /* -Q */
  955.   _bool fSiderial;    /* -s */
  956.   _bool fCusp;        /* -C */
  957.   _bool fUranian;     /* -u */
  958.   _bool fProgress;    /* Are we doing a -p progressed chart?           */
  959.   _bool fInterpret;   /* Is -I interpretation switch in effect?        */
  960.   _bool fFlip;        /* -f */
  961.   _bool fDecan;       /* -3 */
  962.   _bool fGeodetic;    /* -G */
  963.   _bool fPlacalc;     /* -b */
  964.   _bool fWriteFile;   /* -o */
  965.   _bool fGraphics;    /* -X */
  966.  
  967.   /* Main subflags */
  968.   _bool fNoSwitches;
  969.   _bool fLoopInit;    /* -Q0 */
  970.   _bool fSeconds;     /* -b0 */
  971.   _bool fEquator;     /* -sr */
  972.   _bool fSolarArc;    /* -p0 */
  973.   _bool fWritePos;    /* -o0 */
  974.  
  975.   /* Rare flags */
  976.   _bool fTrueNode;    /* -Yn */
  977.   _bool fEuroDate;    /* -Yd */
  978.   _bool fEuroTime;    /* -Yt */
  979.   _bool fSmartCusp;   /* -YC */
  980.   _bool fClip80;      /* -Y8 */
  981.   _bool fWriteOld;    /* -Yo */
  982.  
  983.   /* Value settings */
  984.   int   nEphemYears;  /* -Ey */
  985.   int   nArabic;      /* -P */
  986.   int   nRel;         /* What relationship chart are we doing, if any? */
  987.   int   nHouseSystem; /* -c */
  988.   int   nAsp;         /* -A */
  989.   int   objCenter;    /* -h */
  990.   int   nStar;        /* -U */
  991.   int   nHarmonic;    /* Harmonic chart value passed to -x switch.     */
  992.   int   objOnAsc;     /* House value passed to -1 or -2 switch.        */
  993.   int   dayDelta;     /* -+, -- */
  994.   int   nDegForm;     /* -s */
  995.   int   nDivision;    /* -d */
  996.   int   nScreenWidth; /* -I */
  997.   int   fAnsi;        /* -k */
  998.   real  dstDef;       /* -z0 */
  999.   real  zonDef;       /* -z  */
  1000.   real  lonDef;       /* -l  */
  1001.   real  latDef;       /* -l  */
  1002.  
  1003.   /* Value subsettings */
  1004.  
  1005.   int   nWheelRows;      /* Number of rows per house to use for -w wheel. */
  1006.   int   nAstroGraphStep; /* Latitude step rate passed to -L switch.       */
  1007.   int   nArabicParts;    /* Arabic parts to include value passed to -P.   */
  1008.   real  rZodiacOffset;   /* Position shifting value passed to -s switch.  */
  1009.   real  rProgDay;        /* Progression day value passed to -pd switch.   */
  1010.   int   nRatio1;         /* Chart ratio factors passed to -rc or -rm.     */
  1011.   int   nRatio2;
  1012.   int   nScrollRow;      /* -YQ */
  1013.   int   nArabicNight;    /* -YP */
  1014. } US;
  1015.  
  1016. typedef struct _InternalSettings {
  1017.   _bool fHaveInfo;    /* Do we need to prompt user for chart info?         */
  1018.   _bool fProgress;    /* Are we doing a chart involving progression?       */
  1019.   _bool fMult;        /* Have we already printed at least one text chart?  */
  1020.   _bool fSeconds;     /* Do we print locations to nearest second?          */
  1021.   _bool fSzPersist;   /* Are parameter strings persistent when processing? */
  1022.   _bool fSzInteract;  /* Are we in middle of chart so some setting fixed?  */
  1023.   char *szProgName;   /* The name and path of the executable running.      */
  1024.   char *szFile;       /* The input chart filename string as passed to -i.  */
  1025.   char *szFile2;      /* The second chart filename string as passed to -r. */
  1026.   char *szFileScreen; /* The file to send text output to as passed to -os. */
  1027.   char *szFileOut;    /* The output chart filename string as passed to -o. */
  1028.   char **rgszComment; /* Points to any comment strings after -o filename.  */
  1029.   int cszComment;     /* The number of strings after -o that are comments. */
  1030.   int cchCol;         /* The current column text charts are printing at.   */
  1031.   int cchRow;         /* The current row text charts have scrolled to.     */
  1032.   real rSid;          /* Siderial offset degrees to be added to locations. */
  1033.   real JD;            /* Fractional Julian day for current chart.          */
  1034.   real JDp;           /* Julian day that a progressed chart indicates.     */
  1035. } IS;
  1036.  
  1037. typedef struct _ChartInfo {
  1038.   int mon;   /* Month            */
  1039.   int day;   /* Day              */
  1040.   int yea;   /* Year             */
  1041.   real tim;  /* Time in hours    */
  1042.   real dst;  /* Daylight offset  */
  1043.   real zon;  /* Time zone        */
  1044.   real lon;  /* Longitude        */
  1045.   real lat;  /* Latitude         */
  1046.   char *nam; /* Name for chart   */
  1047.   char *loc; /* Name of location */
  1048. } CI;
  1049.  
  1050. typedef struct _ChartPositions {
  1051.   real obj[objMax];   /* The zodiac positions.    */
  1052.   real alt[objMax];   /* Ecliptic declination.    */
  1053.   real dir[objMax];   /* Retrogradation velocity. */
  1054.   real cusp[cSign+1]; /* House cusp positions.    */
  1055.   byte house[objMax]; /* House each object is in. */
  1056. } CP;
  1057.  
  1058. #ifdef GRAPH
  1059. typedef struct _GraphicsSettings {
  1060.   _bool fBitmap;    /* Are we creating a bitmap file (-Xb set).         */
  1061.   _bool fPS;        /* Are we generating a PostScript file (-Xp set).   */
  1062.   _bool fMeta;      /* Are we generating a metafile graphic (-XM set).  */
  1063.   _bool fColor;     /* Are we drawing a color chart (-Xm not set).      */
  1064.   _bool fInverse;   /* Are we drawing in reverse video (-Xr set).       */
  1065.   _bool fRoot;      /* Are we drawing on the X11 background (-XB set).  */
  1066.   _bool fText;      /* Are we printing chart info on chart (-XT set).   */
  1067.   _bool fFont;      /* Are we simulating fonts in charts (-XM0 set).    */
  1068.   _bool fAlt;       /* Are we drawing in alternate mode (-Xi set).      */
  1069.   _bool fBorder;    /* Are we drawing borders around charts (-Xu set).  */
  1070.   _bool fLabel;     /* Are we labeling objects in charts (-Xl not set). */
  1071.   _bool fJetTrail;  /* Are we not clearing screen on updates (-Xj set). */
  1072.   _bool fMouse;     /* Are we not considering PC mouse inputs.          */
  1073.   _bool fConstel;   /* Are we drawing maps as constellations (-XF set). */
  1074.   _bool fMollewide; /* Are we drawing maps scaled correctly (-XW0 set). */
  1075.   _bool fPrintMap;  /* Are we printing globe names on draw (-XP0 set).  */
  1076.   int xWin;         /* Current size of graphic chart (-Xw).      */
  1077.   int yWin;
  1078.   int nAnim;        /* Current animation mode, if any (-Xn).     */
  1079.   int nScale;       /* Current character scale factor (-Xs).     */
  1080.   int nLeft;        /* Current object to place on Asc (-X1).     */
  1081.   int nTextRows;    /* Numb. of rows to set text screen to (-V). */
  1082.   int nRot;         /* Current rotation degree of globe.         */
  1083.   real rTilt;       /* Current vertical tilt of rotating globe.  */
  1084.   char chBmpMode;   /* Current bitmap file type (-Xb).           */
  1085.   int nOrient;      /* PostScript paper orientation indicator.   */
  1086.   real xInch;       /* PostScript horizontal paper size inches.  */
  1087.   real yInch;       /* PostScript vertical paper size inches.    */
  1088.   char *szDisplay;  /* Current X11 display name (-Xd).           */
  1089.   int nGridCell;    /* Number of cells in -g grids (-Yg).        */
  1090.   int nGlyphs;      /* Settings for what gylphs to use (-YG).    */
  1091. #ifdef PCG
  1092.   int nResHi;       /* 'High-resolution' graphics mode. */
  1093.   int nResLo;       /* 'Flicker-free' graphics mode.    */
  1094. #endif
  1095. } GS;
  1096.  
  1097. typedef struct _GraphicsInternal {
  1098.   int nMode;            /* Current type of chart to create.           */
  1099.   _bool fMono;          /* Is this a monochrome monitor.              */
  1100.   int kiCur;            /* Current color drawing with.                */
  1101.   hpbyte bm;            /* Pointer to allocated memory.               */
  1102.   int cbBmpRow;         /* Horizontal size of bitmap array in memory. */
  1103.   char *szFileOut;      /* Current name of bitmap file (-Xo).         */
  1104.   FILE *file;           /* Actual file handle writing graphics to.    */
  1105.   int yBand;            /* Vertical offset to current bitmap band.    */
  1106.   _bool fFile;          /* Are we making a graphics file.             */
  1107.   int nScale;           /* Scale ratio, i.e. percentage / 100.        */
  1108.   int nScaleT;          /* Relative scale to draw chart text at.      */
  1109.   int nPenWid;          /* Pen width to use when creating metafiles.  */
  1110.   KI kiOn;              /* Foreground color. */
  1111.   KI kiOff;             /* Background color. */
  1112.   KI kiLite;            /* Hilight color.    */
  1113.   KI kiGray;            /* A "dim" color.    */
  1114.   int xOffset;          /* Viewport origin.                           */
  1115.   int yOffset;
  1116.   int xTurtle;          /* Current coordinates of drawing pen.        */
  1117.   int yTurtle;
  1118.   int xPen;             /* Cached coordinates where last line ended.  */
  1119.   int yPen;
  1120. #ifdef X11
  1121.   Display *disp;        /* The opened X11 display (-Xd). */
  1122.   GC gc, pmgc;
  1123.   Pixmap pmap, icon;
  1124.   Window wind, root;
  1125.   int screen;
  1126.   int depth;            /* Number of active color bits.  */
  1127. #endif
  1128. #ifdef PS               /* Variables used by the PostScript generator. */
  1129.   _bool fEps;           /* Are we doing Encapsulated PostScript.    */
  1130.   int cStroke;          /* Number of items drawn without fluahing.  */
  1131.   _bool fLineCap;       /* Are line ends rounded instead of square. */
  1132.   int nDash;            /* How much long are dashes in lines drawn. */
  1133.   int nFont;            /* What system font are we drawing text in. */
  1134.   real rLineWid;        /* How wide are lines, et al, drawn with.   */
  1135. #endif
  1136. #ifdef META             /* Variables used by the metafile generator.  */
  1137.   word HFAR *pwMetaCur; /* Current mem position when making metafile. */
  1138.   word HFAR *pwPoly;    /* Position for start of current polyline.    */
  1139.   long cbMeta;
  1140.   KI kiLineAct;         /* Desired and actual line color. */
  1141.   KI kiLineDes;
  1142.   KI kiFillAct;         /* Desired and actual fill color. */
  1143.   KI kiFillDes;
  1144.   int nFontAct;         /* Desired and actual text font.  */
  1145.   int nFontDes;
  1146.   KI kiTextAct;         /* Desired and actual text color. */
  1147.   KI kiTextDes;
  1148.   int nAlignAct;        /* Desired/actual text alignment. */
  1149.   int nAlignDes;
  1150. #endif
  1151. #ifdef MSG              /* MS graphics PC specific global variables.  */
  1152.   int nRes;             /* Current graphics mode.                     */
  1153.   struct videoconfig cfg;          /* State of current graphics mode. */
  1154. #endif
  1155. #ifdef BGI              /* Borland BGI PC specific global variables.  */
  1156.   int nRes;             /* Current graphics mode.              */
  1157.   _bool fLoaded;        /* Have we loaded the graphics driver. */
  1158.   int nDriver;          /* Current graphics driver.            */
  1159.   int nGraph;           /* Current mode within driver.         */
  1160.   int nPages;           /* Number of pages in current mode.    */
  1161.   int nPageCur;         /* The current page bring drawn in.    */
  1162. #endif
  1163. } GI;
  1164. #endif /* GRAPH */
  1165.  
  1166. typedef struct _PartInfo {
  1167.   char *form;
  1168.   char *name;
  1169. } PI;
  1170.  
  1171. typedef struct _ElementTable {
  1172.   int coSum;            /* Total objects considered.          */
  1173.   int coHemi;           /* Number that can be in hemispheres. */
  1174.   int coSign[cSign];    /* Number of objects in each sign.    */
  1175.   int coHouse[cSign];   /* Number of objects in each house.   */
  1176.   int coElemMode[4][3]; /* Objects in each elem/mode combo.   */
  1177.   int coElem[4];        /* Object in each element.            */
  1178.   int coMode[3];        /* Objects in each sign mode.         */
  1179.   int coModeH[3];       /* Objects in each house mode.        */
  1180.   int coYang;           /* Objects in Fire/Air signs.         */
  1181.   int coYin;            /* Objects in Earth/Water signs.      */
  1182.   int coLearn;          /* Objects in first six signs.        */
  1183.   int coShare;          /* Objects in last six signs.         */
  1184.   int coAsc;            /* Objects in Eastern houses.         */
  1185.   int coDes;            /* Objects in Western houses.         */
  1186.   int coMC;             /* Objects in Southern houses.        */
  1187.   int coIC;             /* Objects in Northern houses.        */
  1188. } ET;
  1189.  
  1190. typedef struct _OrbitalElements {
  1191.   real ma0, ma1, ma2; /* Mean anomaly.           */
  1192.   real ec0, ec1, ec2; /* Eccentricity.           */
  1193.   real sma;           /* Semi-major axis.        */
  1194.   real ap0, ap1, ap2; /* Argument of perihelion. */
  1195.   real an0, an1, an2; /* Ascending node.         */
  1196.   real in0, in1, in2; /* Inclination.            */
  1197. } OE;
  1198.  
  1199.  
  1200. #include "extern.h"
  1201.  
  1202. /* astrolog.h */
  1203.